package com.digitalchina.lxnsy.activity.old;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.base.BaseActivity;
import com.digitalchina.lxnsy.entity.WithdrawHistoryVO;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.activity
 * 创建人：郑皓
 * 创建时间：2018/10/11 11:49
 * 修改备注：
 * ================================================
 */
public class WithdrawHistoryDetailActivity extends BaseActivity {

    @Bind(R.id.view_top1)
    View viewTop1;
    @Bind(R.id.iv_dot1)
    ImageView ivDot1;
    @Bind(R.id.view_bottom1)
    View viewBottom1;
    @Bind(R.id.tv_name1)
    TextView tvName1;
    @Bind(R.id.tv_time1)
    TextView tvTime1;
    @Bind(R.id.view_top2)
    View viewTop2;
    @Bind(R.id.iv_dot2)
    ImageView ivDot2;
    @Bind(R.id.view_bottom2)
    View viewBottom2;
    @Bind(R.id.tv_name2)
    TextView tvName2;
    @Bind(R.id.tv_time2)
    TextView tvTime2;
    @Bind(R.id.view_top3)
    View viewTop3;
    @Bind(R.id.iv_dot3)
    ImageView ivDot3;
    @Bind(R.id.view_bottom3)
    View viewBottom3;
    @Bind(R.id.tv_name3)
    TextView tvName3;
    @Bind(R.id.tv_time3)
    TextView tvTime3;
    @Bind(R.id.withdrawMoney)
    TextView withdrawMoney;
    @Bind(R.id.withdrawProceduresMoney)
    TextView withdrawProceduresMoney;
    @Bind(R.id.realWithdrawMoney)
    TextView realWithdrawMoney;
    @Bind(R.id.withdrawWay)
    TextView withdrawWay;


    private WithdrawHistoryVO vo;

    @Override
    public void setLayout() {
        setContentLayout(R.layout.activity_withdraw_history_detail);
        setTitle("提现详情");
    }

    @Override
    public void initMember() {
        vo = (WithdrawHistoryVO) getIntent().getSerializableExtra("WithdrawHistoryVO");

        if (vo == null)
            return;

        /**
         * 提现状态
         * 待审核 0
         * 处理中 1
         * 已到账 2
         * 审核失败 3
         */
        switch (vo.getWithdrawStatus()) {
            case "0":
                ivDot2.setBackgroundResource(R.drawable.ic_green_dot);
                viewBottom1.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewTop2.setBackgroundColor(getResources().getColor(R.color.app_color));
                tvName2.setTextColor(getResources().getColor(R.color.app_color));

                tvTime1.setText(vo.getStartTime());
                tvName2.setText("处理中");
                tvName3.setText("等待到账");
                break;
            case "1":

                break;
            case "2":
                ivDot2.setBackgroundResource(R.drawable.ic_green_dot);
                ivDot3.setBackgroundResource(R.drawable.ic_green_dot);
                viewBottom1.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewTop2.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewBottom2.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewTop3.setBackgroundColor(getResources().getColor(R.color.app_color));
                tvName2.setTextColor(getResources().getColor(R.color.app_color));
                tvName3.setTextColor(getResources().getColor(R.color.app_color));

                tvTime1.setText(vo.getStartTime());
                tvTime2.setText(vo.getEndTime());
                tvTime3.setText(vo.getEndTime());

                tvName2.setText("处理成功");
                tvName3.setText("到账成功");

                break;
            default:
                ivDot2.setBackgroundResource(R.drawable.ic_green_dot);
                ivDot3.setBackgroundResource(R.drawable.ic_green_dot);
                viewBottom1.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewTop2.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewBottom2.setBackgroundColor(getResources().getColor(R.color.app_color));
                viewTop3.setBackgroundColor(getResources().getColor(R.color.app_color));
                tvName2.setTextColor(getResources().getColor(R.color.app_color));
                tvName3.setTextColor(getResources().getColor(R.color.app_color));

                tvTime1.setText(vo.getStartTime());
                tvTime2.setText(vo.getEndTime());
                tvTime3.setText(vo.getEndTime());

                tvName2.setText("处理成功");
                tvName3.setText("到账失败");
                break;
        }


        /**
         * 提现方式
         * 银行卡 0
         * 支付宝 1
         * 微信 2
         */

        String s;

        switch (vo.getWithdrawWay()) {
            case "0":
                s = "银行卡（" + vo.getBankName() + "）";
                break;
            case "1":
                s = "支付宝（" + vo.getAccountNumber() + "）";
                break;
            case "2":
                s = "微信（" + vo.getWxNickName() + "）";
                break;
            default:
                s = "其他";
                break;
        }

        withdrawWay.setText(s);


        withdrawMoney.setText("￥" + vo.getWithdrawMoney());
        withdrawProceduresMoney.setText("￥" + vo.getWithdrawProceduresMoney());
        realWithdrawMoney.setText("￥" + vo.getRealWithdrawMoney());



    }

    @Override
    public void addListener() {

    }

    @Override
    public void setHandler() {

    }

    @Override
    public void callBack(Object object) {

    }

    @Override
    public void rightOnClick() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
